package exc;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.RemoteWebElement;

public class TestBaiduDemo {
	public static void main(String[] args){
		System.setProperty("webdriver.chrome.driver","c:\\test\\chromedriver.exe");
		
		WebDriver driver = new ChromeDriver();
//		WebElement webEle;
		driver.get("http://www.beyondsoft.com/");
		WebElement title = driver.findElement(By.xpath("//*[@id='logo']/a/img"));
		
		System.out.println(driver.findElement(By.xpath("//*[@id='bottom']/div[3]")).getText() + ":    bottom");
		
		RemoteWebElement element = (RemoteWebElement)driver.findElement(By.xpath("//*[@id='mainnav']/div[8]/a"));
		Actions action = new Actions(element.getWrappedDriver());
		action.moveToElement(title, 100, -100);
		action.perform();
		action.moveToElement(element);
		action.perform();
		
		String name = driver.findElement(By.xpath("//*[@id='mainnav']/div[8]/div/div/dl/dt[1]/a")).getText();
		System.out.println(name + ":  name");
//		driver.quit();
		
////		网页
//		driver.get("http://baidu.com");
//		webEle = driver.findElement(By.id("kw"));
//		webEle.isDisplayed();
//		webEle.sendKeys("56 微博江湖");
//		webEle.clear();
//		webEle.submit();
//
////		新闻
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[1]"));
////		webEle = driver.findElement(By.name("tj_news"));
//		webEle.click();
//		webEle = driver.findElement(By.id("ww"));
//		webEle.sendKeys("钓鱼岛");
//		webEle.submit();
//		
//		
////		贴吧 
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[2]"));
//		webEle.click();
//		webEle = driver.findElement(By.id("wd1"));
//		webEle.sendKeys("MM");
//		webEle.submit();
//		
////		知道
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[3]"));
//		webEle.click();
//		webEle = driver.findElement(By.className("hdi"));
//		webEle.sendKeys("the difference of Myeclipse and eclipse");
//		webEle.submit();
//		
////		Mp3
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[4]"));
//		webEle.click();
//		webEle = driver.findElement(By.id("ww"));
//		webEle.sendKeys("曲婉婷-我的歌声里");
//		webEle.submit();
//		
////		图片
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[5]"));
//		webEle.click();
//		webEle = driver.findElement(By.id("kw"));
//		webEle.sendKeys("刘亦菲");
//		webEle.submit();
//		
////		视频
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[6]"));
//		webEle.click();
//		webEle = driver.findElement(By.className("s_ipt_wr"));
//		webEle.sendKeys("中国好声音");
//		webEle.submit();
//		
////		地图
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='nv']/a[7]"));
//		webEle.click();
//		webEle = driver.findElement(By.id("PoiSearch"));
//		webEle.sendKeys("湖北省洪山区雄楚大道荣军医院");
//		webEle.submit();
//		
////		百科
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='lk']/a[1]"));
//		webEle.click();
//		webEle = driver.findElement(By.id("word"));
//		webEle.sendKeys("蒋介石故居");
//		webEle.submit();
////		百科byname
////		driver.get("http://www.baidu.com");
////		webEle = driver.findElement(By.name("tj_baike"));
////		webEle.click();
//		
////		文库
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='lk']/a[2]"));
//		webEle.click();
//		webEle = driver.findElement(By.className("s_ipt"));
//		webEle.sendKeys("2012年土地估价师考试相关知识冲刺模拟试题及答案");
//		webEle.submit();
//		
////		hao123
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='lk']/a[3]"));
//		webEle.click();
//		webEle = driver.findElement(By.className("js_word"));
//		webEle.sendKeys("天");
//		webEle.submit();
//		
////		更多
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.xpath("//*[@id='lk']/span/a"));
//		webEle.click();
//		webEle = driver.findElement(By.className("i"));
//		webEle.sendKeys("百度网盘");
//		webEle.submit();
//		
////		button
//		driver.get("http://www.baidu.com");
//		webEle = driver.findElement(By.id("su"));
//		webEle.click();
//		
//		driver.quit();
		
	}
}
